package br.com.gsh.servlet;

import java.io.IOException;
import java.sql.SQLException;

import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;

import br.com.gsh.conexao.ConexaoFactory;

public class DeslogarServlet extends HttpServlet{

	private static final long serialVersionUID = -154340731751042775L;
	
	@Override
	protected void service(HttpServletRequest request, HttpServletResponse response)
			throws ServletException, IOException {
		
		ConexaoFactory factory = new ConexaoFactory();
		
		try {
			factory.getConexao().close();
		} catch (SQLException e) {
			e.printStackTrace();
		}
		
		request.getSession().invalidate();
		response.sendRedirect("/Twitter/jsp/login.jsp");
		
	}
	

}


